<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    {include file="../tpl/header.html" /}
</head>
<script type="text/javascript" src="{$conf['static_url']}/admin/js/xcity.js?{$PUBCJ}"></script>
<body>
{include file="../tpl/menu.html" /}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">

                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5" action="{:url('admin/admin/regionList')}">

                        <div class="layui-inline layui-show-xs-block x-city" id="area_info">
                            <div class="layui-input-inline">
                                <select name="province" lay-filter="province">
                                    <option value="">请选择省</option>
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="city" lay-filter="city">
                                    <option value="">请选择市</option>
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="area" lay-filter="area">
                                    <option value="">请选择县/区</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                        </div>

                    </form>
                </div>

                <div class="layui-card-header">
                    {if condition="check_auth('admin/admin/regionAdd')"}
                    <button class="layui-btn" onclick="xadmin.open('添加','{:url('admin/admin/regionAdd')}')"><i class="layui-icon"></i>添加</button>
                    {/if}
                    {if condition="check_auth('admin/admin/setRegionCache')"}
                    <button class="layui-btn layui-btn-danger" onclick="request_result('{:url('admin/admin/setRegionCache')}','将数据写入redis?')"><i class="layui-icon"></i>更新缓存</button>
                    {/if}
                    {if condition="check_auth('admin/admin/regionAddExample')"}
                    <button class="layui-btn" onclick="xadmin.open('添加使用示例','{:url('admin/admin/regionAddExample')}')"><i class="layui-icon"></i>添加使用示例</button>
                    {/if}
                    {if condition="check_auth('admin/admin/regionEditExample')"}
                    <button class="layui-btn layui-bg-blue" onclick="xadmin.open('修改使用示例','{:url('admin/admin/regionEditExample',['region_code' => 421023])}',600,800)"><i class="layui-icon">&#xe642;</i>修改使用示例</button>
                    {/if}
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>地区码</th>
                            <th>名称</th>
                            <th>排序号</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                        {volist name="list" id="vo"}
                        <tr>
                            <td>{$vo['region_code']}</td>
                            <td>{$vo['region_name']}</td>
                            <td>{$vo['px']}</td>
                            <td class="td-manage">
                                {if condition="check_auth('admin/admin/regionEdit')"}
                                <button title="编辑" class="layui-btn layui-bg-blue layui-btn-xs" onclick="xadmin.open('编辑','{:url('admin/admin/regionEdit',['region_code' => $vo['region_code']])}')" >
                                    <i class="layui-icon">&#xe642;</i>编辑
                                </button>
                                {/if}
                                {if condition="check_auth('admin/admin/regionDel')"}
                                <button title="删除" class="layui-btn-danger layui-btn layui-btn-xs" onclick="del(this,'{$vo.region_code}','{:url('admin/admin/regionDel')}')" href="javascript:;" >
                                    <i class="layui-icon">&#xe640;</i>删除
                                </button>
                                {/if}
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        {$page_info|raw}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['laydate','form','code'], function(){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#start_date'
        });
        laydate.render({
            elem: '#end_date'
        });
        form = layui.form;
        layui.code();
        $('#area_info').xcity("{$area_info['province']}","{$area_info['city']}","{$area_info['area']}");
    });

</script>
</body>
</html>